package com.bourne.util;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;
import java.util.List;

/**
 * @program base_farme
 * @description
 * @author: bourne
 * @create 2021-23-13 15:23:21
 **/
@Data
public class PageData<T> {

    /**
     * 分页后返回数据
     */
    private List<T> dataList;

    /**
     * 数据总数量
     */
    private Long totalData;

    /**
     * 每页数据量
     */
    private Long pageSize;

    /**
     * 当前页码
     */
    private Long currentSize;

    /**
     * 总计页数
     */
    private Long totalPage;

    public PageData(IPage<T> pageBack) {
        this.dataList = pageBack.getRecords();
        this.totalData = pageBack.getTotal();
        this.pageSize = pageBack.getSize();
        this.currentSize = pageBack.getCurrent();
        this.totalPage = pageBack.getPages();
    }
}
